<template>
  <div style="background-color: #597aff">
    <h1>个人信息管理中心</h1>
  </div>
</template>

<script>
    import store from "../vuex/store";
    import router from "../router";

    export default {
        name: "Center",
      //钩子函数，进入路由之前要将查看登录信息是否仍在，防止因为刷新页面（关掉页面就丢失
      beforeRouteEnter: (to, from, next) => {
        if (store.state.loginName === ""){
          if (sessionStorage.getItem("memoryId") === null){
            router.push('/Login');
            alert("请先登录");
          }
          store.commit("increment",sessionStorage.getItem("memoryId"));
        }
        next();
      },
    }
</script>

<style scoped>

</style>
